package com.jack.charging.order.dao.repository.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jack.charging.order.dao.mapper.OrderFailMapper;
import com.jack.charging.order.dao.repository.OrderRepository;
import com.jack.charging.order.pojo.po.ChargingBillFail;
import com.jack.charging.order.pojo.po.ChargingBillSuccess;
import org.springframework.beans.factory.annotation.Autowired;
import com.jack.charging.order.dao.mapper.OrderSuccessMapper;
import org.springframework.stereotype.Repository;

/**
 * @author Jack
 * @date 2025/2/13 15:08
 * @see
 * @since
 */
@Repository
public class OrderRepositoryImpl implements OrderRepository {
    @Autowired
    private OrderSuccessMapper orderSuccessMapper;
    @Autowired
    private OrderFailMapper orderFailMapper;
    @Override
    public ChargingBillSuccess getChargingBillSuccessByOrderNo(String orderNo) {
       QueryWrapper wrapper = new QueryWrapper();
       wrapper.eq("order_no",orderNo);
       return orderSuccessMapper.selectOne(wrapper);
    }

    @Override
    public ChargingBillFail getChargingBillFailByOrderNo(String orderNo) {
        QueryWrapper wrapper = new QueryWrapper();
        wrapper.eq("order_no",orderNo);
        return orderFailMapper.selectOne(wrapper);
    }

    @Override
    public int insertFailOrder(ChargingBillFail chargingBillFail) {
        return orderFailMapper.insert(chargingBillFail);
    }
}
